home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <stdio.h>
- #include <stdlib.h>
- char FileName[200];
- char Destination[200];
- void sr(char *s);
- main(int argc,char *argv[])
- {
- FILE *fi,*fo;
- int counter=0;
- int users=0;
- int linecount=0;
- if(argc<2)
- {
- printf("AlignVal version 1.0, written by Joseph Hodge\n");
- printf("This utility will insure that Validate.Dat is properly aligned\n");
- printf("usage: AlignVal <filename>\n");
- printf("\n");
- exit(0);
- }
-
- strcpy(FileName,argv[1]);
- sr(FileName);
-
- fi=fopen(FileName,"r");
- if(fi==NULL)
- {
- printf("Error, can't locate file %s\n",FileName);
- exit(0);
- }
-
- strcpy(Destination,FileName); strcat(Destination,"{key}");
- fo=fopen(Destination,"w");
- while(fgets(FileName,100,fi)!=NULL)
- {
- linecount++;
- sr(FileName);strupr(FileName);
- if(counter>=16 && argc==2)
- {
- fprintf(fo,"\nError in account after line %d\n",linecount);
- printf("Error in account after line %d\n",linecount);
-
- fclose(fi);
- fclose(fo);
- exit(0);
- }
- if(!strnicmp(FileName,"Name",4))
- {
- counter=0; users++;
- fprintf(fo,"%s ",FileName); if(argc==3) fprintf(fo,"\n");
- }
- if(counter==6 && argc==2)
- {
- fprintf(fo,"%s\n",&FileName[47]);
- }
- counter++;
- }
- fclose(fi);
- fclose(fo);
- exit(0);
- }
-
- void sr(char *s)
- {
- register int i;
- i=strlen(s)-1;
- while(i>-1)
- {
- if(*(s+i)<=32) *(s+i)='\0'; else break;
- i--;
- }
- }